Skip to content

[release/8.0] Fix: hardening http2 to refuse newline chars on trailers and dynamic HPACK table - #69250

Merged
SamMonoRT merged 3 commits into
release/8.0from
brecon/80valid
Sep 14, 2026
Merged

SamMonoRT merged 3 commits into
release/8.0from
brecon/80valid

Conversation

@BrennanConroy

Copy link
Copy Markdown
Member

Backport of #68743 to release/8.0

Fix: hardening http2 to refuse newline chars on trailers and dynamic HPACK table

Description

Kestrel previously skipped validation for CR/LF in two places: request trailers and HPACK dynamic table retrieval. Based on RFC 7540 section 10.3, these values must be treated as malformed. The validation for newline characters has now been enabled along with tests to ensure compliance.

Customer Impact

Invalid headers could show up in logs or application logic processing.

Regression?

  • Yes
  • No

Risk

  • High
  • Medium
  • Low

Good test coverage, easy to reason about change

Verification

  • Manual (required)
  • Automated

Packaging changes reviewed?

  • Yes
  • No
  • N/A

amf-fs and others added 2 commits September 11, 2026 11:30
…HPACK table (#68743)

* Hardening trailers to refuse new line chars

* Hardening HPACK dynamic header to refuse new line chars

* Http3 request trailers with newline chars test

* Added test to exercise newline chars on indexed headers
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot AI lite review requested due to automatic review settings September 11, 2026 18:32
@BrennanConroy BrennanConroy added Servicing-consider Shiproom approval is required for the issue feature-kestrel area-networking Includes servers, yarp, json patch, bedrock, websockets, http client factory, and http abstractions labels Sep 11, 2026
@dotnet-policy-service

Copy link
Copy Markdown
Contributor

Hi @BrennanConroy. Please make sure you've updated the PR description to use the Shiproom Template. Also, make sure this PR is not marked as a draft and is ready-to-merge.

To learn more about how to prepare a servicing PR click here.

@dotnet-policy-service dotnet-policy-service Bot added this to the 8.0.x milestone Sep 11, 2026
@dotnet-policy-service

Copy link
Copy Markdown
Contributor

Hi @BrennanConroy. If this is not a tell-mode PR, please make sure to follow the instructions laid out in the servicing process document.
Otherwise, please add tell-mode label.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot review overview

🟢 Approval recommended

The only finding is a minor, non-blocking test assertion nit.

Review tier: Lite
Findings: None

What changed in this PR

Backports Kestrel hardening to reject CR/LF characters in HTTP/2 trailers and dynamic HPACK values.

Changes:

  • Enables newline validation for trailers and dynamic HPACK headers.
  • Adds HTTP/2 and HTTP/3 regression coverage.
File Description
src/​Servers/​Kestrel/​test/​InMemory.FunctionalTests/​Http3/​Http3StreamTests.cs Tests trailer newline rejection; includes a minor assertion-message nit.
src/​Servers/​Kestrel/​test/​InMemory.FunctionalTests/​Http2/​Http2StreamTests.cs Tests dynamic-table newline rejection.
src/​Servers/​Kestrel/​test/​InMemory.FunctionalTests/​Http2/​Http2ConnectionTests.cs Adds invalid trailer cases.
src/​Servers/​Kestrel/​Core/​src/​Internal/​Http2/​Http2Connection.cs Validates dynamic HPACK header values.
src/​Servers/​Kestrel/​Core/​src/​Internal/​Http/​HttpProtocol.cs Validates request trailer values.

💡 Add a code-review agent skill for context-aware, tailored reviews. Learn more in the docs.

@BrennanConroy BrennanConroy added Servicing-approved Shiproom has approved the issue and removed Servicing-consider Shiproom approval is required for the issue labels Sep 11, 2026
@dotnet-policy-service

Copy link
Copy Markdown
Contributor

Hi @BrennanConroy. This PR was just approved to be included in the upcoming servicing release. Somebody from the @dotnet/aspnet-build team will get it merged when the branches are open. Until then, please make sure all the CI checks pass and the PR is reviewed.

Remove assertion for ConnectionEndReason in Http2StreamTests.
@SamMonoRT
SamMonoRT enabled auto-merge September 14, 2026 18:06
@rbhanda rbhanda modified the milestones: 8.0.x, 8.0.31, 8.0.32 Sep 14, 2026
@SamMonoRT
SamMonoRT disabled auto-merge September 14, 2026 18:12
@SamMonoRT
SamMonoRT merged commit 30024c2 into release/8.0 Sep 14, 2026
24 of 27 checks passed
@SamMonoRT
SamMonoRT deleted the brecon/80valid branch September 14, 2026 18:12
@dotnet-policy-service dotnet-policy-service Bot removed this from the 8.0.32 milestone Sep 14, 2026
This was referenced Oct 26, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area-networking Includes servers, yarp, json patch, bedrock, websockets, http client factory, and http abstractions feature-kestrel Servicing-approved Shiproom has approved the issue

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants